Skip to content

fix: CLI always reported version 0.1.0#10

Merged
sweetmantech merged 2 commits intomainfrom
fix/version-reporting
Feb 25, 2026
Merged

fix: CLI always reported version 0.1.0#10
sweetmantech merged 2 commits intomainfrom
fix/version-reporting

Conversation

@sweetmantech
Copy link
Copy Markdown
Contributor

@sweetmantech sweetmantech commented Feb 25, 2026

Summary

  • recoup --version was hardcoded to 0.1.0 in bin.ts, so every published version (0.1.1 through 0.1.7) reported itself as 0.1.0
  • Now reads the version from package.json at runtime using __dirname (works in CJS bundle)
  • Reorders the publish workflow to bump version before pnpm build, so the built artifact includes the correct version

Root cause

  1. bin.ts had .version("0.1.0") hardcoded
  2. The publish workflow ran pnpm build before npm version patch, so even if the version were read at build time, it would be stale

Test plan

  • Failing test: expected '0.1.0' to be '0.1.7'
  • Fix applied, test passes
  • Full suite: 46 tests pass across 9 files
  • node dist/bin.cjs --version outputs 0.1.7

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Tests

    • Added automated tests to verify CLI version output.
  • Chores

    • Optimized build and test execution order in CI/CD workflows.
    • Enhanced CLI version handling to use dynamic package source instead of hardcoded values.

The version was hardcoded as "0.1.0" in bin.ts, so every published
version reported itself as 0.1.0 regardless of the actual version.

Also reorders the publish workflow to bump version before building,
so the built artifact includes the correct version.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Feb 25, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4e7087d and c15c19a.

📒 Files selected for processing (4)
  • .github/workflows/publish.yml
  • .github/workflows/test.yml
  • __tests__/bin.test.ts
  • src/bin.ts

📝 Walkthrough

Walkthrough

The pull request reorders build and test steps in CI workflows, adds CLI version validation testing, and changes the CLI to dynamically read version from package.json rather than using a hardcoded value.

Changes

Cohort / File(s) Summary
CI Workflow Reordering
.github/workflows/publish.yml, .github/workflows/test.yml
Build step moved after version bump in publish workflow; test step moved after build step in test workflow. Both changes affect operation sequencing without modifying step logic.
CLI Version Management
src/bin.ts
Added imports for file system and path utilities. Version now dynamically loaded from package.json instead of hardcoded "0.1.0". Additional commands registered (chats, notifications, sandboxes, orgs) with program.parse() call added.
CLI Version Testing
__tests__/bin.test.ts
New test file validates CLI --version output matches package.json version by reading package manifest, executing dist/bin.cjs with --version flag, and comparing trimmed output.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Poem

🐰 The version hops from static stone,
now reads from package, its true home.
Tests run after builds stand tall,
workflows dance in order through it all! ✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/version-reporting

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

The version test requires dist/bin.cjs to exist.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sweetmantech sweetmantech merged commit fa33d31 into main Feb 25, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant